﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace AplikasiDariTooltip
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            linkLabel1.Text = textBox1.Text;
        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {
            tooltipPreview1.SetToolTip(linkLabel1, textBox2.Text);
        }

        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            LinkLabel linklabele = sender as LinkLabel;
            string datas ="http://"+tooltipPreview1.GetToolTip(linklabele);
            this.webBrowser1.Url = new System.Uri(datas, System.UriKind.Absolute);            
        }

        private void linkLabel1_MouseHover(object sender, EventArgs e)
        {
            LinkLabel links = sender as LinkLabel;
            tooltipPreview1.PreviewWeb(links);
            string data = "When click link view browser will change";
            label1.Text = data;
        }

        private void linkLabel1_MouseLeave(object sender, EventArgs e)
        {
            string data="LinkLabel will change automaticly when text and tooltip changed";
            label1.Text = data;
        }
    }
}
